package com.ozan.kemal.beans;

import com.ozan.kemal.controller.UserMgr;
import com.ozan.kemal.model.User;

public class SignUpBean {
 
	
	private User myUser=new User();
	private UserMgr userMgr = UserMgr.getInstance();
	
	private String errorMessage;
	
	public User getMyUser() {
		return myUser;
	}

	public void setMyUser(User myUser) {
		this.myUser = myUser;
	}
	
	
	
	public String save(){
	
		if(myUser!=null){
		
			
			try {
				userMgr.addNewUser(myUser);
			} catch (Exception e) {
				
				setErrorMessage(e.getMessage());
				return "";
			}
		
		
		}
		
		return "homePage";
	}

	public String getErrorMessage() {
		return errorMessage;
	}

	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}
	
}
